home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / dev / lang / Python16_Src.lha / Python16_Source / Python / thread_foobar.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-08-03  |  2.8 KB  |  132 lines

  1. /*
  2.  * Initialization.
  3.  */
  4. static void PyThread__init_thread _P0()
  5. {
  6. }
  7.  
  8. /*
  9.  * Thread support.
  10.  */
  11. int PyThread_start_new_thread _P2(func, void (*func) _P((void *)), arg, void *arg)
  12. {
  13.     int success = 0;    /* init not needed when SOLARIS_THREADS and */
  14.                 /* C_THREADS implemented properly */
  15.  
  16.     dprintf(("PyThread_start_new_thread called\n"));
  17.     if (!initialized)
  18.         PyThread_init_thread();
  19.     return success < 0 ? 0 : 1;
  20. }
  21.  
  22. long PyThread_get_thread_ident _P0()
  23. {
  24.     if (!initialized)
  25.         PyThread_init_thread();
  26. }
  27.  
  28. static void do_PyThread_exit_thread _P1(no_cleanup, int no_cleanup)
  29. {
  30.     dprintf(("PyThread_exit_thread called\n"));
  31.     if (!initialized)
  32.         if (no_cleanup)
  33.             _exit(0);
  34.         else
  35.             exit(0);
  36. }
  37.  
  38. void PyThread_exit_thread _P0()
  39. {
  40.     do_PyThread_exit_thread(0);
  41. }
  42.  
  43. void PyThread__exit_thread _P0()
  44. {
  45.     do_PyThread_exit_thread(1);
  46. }
  47.  
  48. #ifndef NO_EXIT_PROG
  49. static void do_PyThread_exit_prog _P2(status, int status, no_cleanup, int no_cleanup)
  50. {
  51.     dprintf(("PyThread_exit_prog(%d) called\n", status));
  52.     if (!initialized)
  53.         if (no_cleanup)
  54.             _exit(status);
  55.         else
  56.             exit(status);
  57. }
  58.  
  59. void PyThread_exit_prog _P1(status, int status)
  60. {
  61.     do_PyThread_exit_prog(status, 0);
  62. }
  63.  
  64. void PyThread__exit_prog _P1(status, int status)
  65. {
  66.     do_PyThread_exit_prog(status, 1);
  67. }
  68. #endif /* NO_EXIT_PROG */
  69.  
  70. /*
  71.  * Lock support.
  72.  */
  73. PyThread_type_lock PyThread_allocate_lock _P0()
  74. {
  75.  
  76.     dprintf(("PyThread_allocate_lock called\n"));
  77.     if (!initialized)
  78.         PyThread_init_thread();
  79.  
  80.     dprintf(("PyThread_allocate_lock() -> %lx\n", (long)lock));
  81.     return (PyThread_type_lock) lock;
  82. }
  83.  
  84. void PyThread_free_lock _P1(lock, PyThread_type_lock lock)
  85. {
  86.     dprintf(("PyThread_free_lock(%lx) called\n", (long)lock));
  87. }
  88.  
  89. int PyThread_acquire_lock _P2(lock, PyThread_type_lock lock, waitflag, int waitflag)
  90. {
  91.     int success;
  92.  
  93.     dprintf(("PyThread_acquire_lock(%lx, %d) called\n", (long)lock, waitflag));
  94.     dprintf(("PyThread_acquire_lock(%lx, %d) -> %d\n", (long)lock, waitflag, success));
  95.     return success;
  96. }
  97.  
  98. void PyThread_release_lock _P1(lock, PyThread_type_lock lock)
  99. {
  100.     dprintf(("PyThread_release_lock(%lx) called\n", (long)lock));
  101. }
  102.  
  103. /*
  104.  * Semaphore support.
  105.  */
  106. PyThread_type_sema PyThread_allocate_sema _P1(value, int value)
  107. {
  108.     dprintf(("PyThread_allocate_sema called\n"));
  109.     if (!initialized)
  110.         PyThread_init_thread();
  111.  
  112.     dprintf(("PyThread_allocate_sema() -> %lx\n", (long) sema));
  113.     return (PyThread_type_sema) sema;
  114. }
  115.  
  116. void PyThread_free_sema _P1(sema, PyThread_type_sema sema)
  117. {
  118.     dprintf(("PyThread_free_sema(%lx) called\n", (long) sema));
  119. }
  120.  
  121. int PyThread_down_sema _P2(sema, PyThread_type_sema sema, waitflag, int waitflag)
  122. {
  123.     dprintf(("PyThread_down_sema(%lx, %d) called\n", (long) sema, waitflag));
  124.     dprintf(("PyThread_down_sema(%lx) return\n", (long) sema));
  125.     return -1;
  126. }
  127.  
  128. void PyThread_up_sema _P1(sema, PyThread_type_sema sema)
  129. {
  130.     dprintf(("PyThread_up_sema(%lx)\n", (long) sema));
  131. }
  132.